+lsb (3.2-14) unstable; urgency=low
+
+ * Update pidofproc(), status_of_proc() to sync with Ubuntu.
+ Thanks to Dustin Kirkland. (Closes: #490095)
+ * Add hooks to init-functions, thanks to Miroslav Jezbera.
+ These are documented in README.Debian in lsb-base.
+ (Closes: #490408)
+
+ -- Chris Lawrence <lawrencc@debian.org> Mon, 14 Jul 2008 11:30:52 -0500
+
lsb (3.2-13) unstable; urgency=low
* Include status_of_proc() function from Ubuntu's lsb-base.
"Fancy output" can be overriden by setting FANCYTTY=0 in this file.
- -- Chris Lawrence <lawrencc@debian.org>, Sat, 26 Aug 2006 21:40:06 -0500
+From lsb-base 3.2-14, you can use the following hook functions which
+are called by the appropriate functions, instead of supplying your own
+logging functions:
+
+log_daemon_msg_pre
+log_daemon_msg_post
+log_end_msg_pre
+log_end_msg_post
+log_action_end_msg_post
+log_action_end_msg_post
+
+Each function receives all of the arguments sent to the parent
+function; the "pre" functions operate before any output, while the
+"post" functions operate after the output is produced.
+
+ -- Chris Lawrence <lawrencc@debian.org>, Mon, 14 Jul 2008 11:34:48 -0500
if $(kill -0 "${pid:-}" 2> /dev/null); then
echo "$pid"
return 0
+ elif ps "${pid:-}" >/dev/null 2>&1; then
+ echo "$pid"
+ return 0 # program is running, but not owned by this user
else
return 1 # program is dead and /var/run pid file exists
fi
fi
fi
if [ -x /bin/pidof -a ! "$specified" ]; then
- /bin/pidof -o %PPID $1
- status="$?"
+ status="0"
+ /bin/pidof -o %PPID $1 || status="$?"
if [ "$status" = 1 ]; then
return 3 # program is not running
fi
if [ -n "$sig" ]; then
return 0
fi
- return 0 # program is not running
+ return 3 # program is not running
fi
if [ "$status" = 0 -a "$is_term_sig" = yes ]; then
# Return LSB status
status_of_proc () {
- local daemon name status
+ local pidfile daemon name status
+
+ pidfile=
+ OPTIND=1
+ while getopts p: opt ; do
+ case "$opt" in
+ p) pidfile="$OPTARG";;
+ esac
+ done
+ shift $(($OPTIND - 1))
+
+ if [ -n "$pidfile" ]; then
+ pidfile="-p $pidfile"
+ fi
daemon="$1"
name="$2"
+
status="0"
- if [ -x /bin/pidof ]; then
- /bin/pidof -o %PPID "$daemon" >/dev/null || status="$?"
- if [ "$status" = 0 ]; then
- log_success_msg "$name is running."
- else
- log_failure_msg "$name is not running."
- fi
+ pidofproc $pidfile $daemon >/dev/null || status="$?"
+ if [ "$status" = 0 ]; then
+ log_success_msg "$name is running."
+ return 0
else
- log_failure_msg "/bin/pidof not available."
- status="1"
+ log_failure_msg "$name is not running."
+ return $status
fi
- return "$status"
}
log_use_fancy_output () {
if [ -z "${1:-}" ]; then
return 1
fi
+ log_daemon_msg_pre "$@"
if [ -z "${2:-}" ]; then
echo -n "$1:"
fi
echo -n "$1: $2"
+ log_daemon_msg_post "$@"
}
# #319739
if [ -z "${1:-}" ]; then
return 1
fi
+ log_end_msg_pre "$@"
# Only do the fancy stuff if we have an appropriate terminal
# and if /usr is already mounted
echo " failed!"
fi
fi
+ log_end_msg_post "$@"
return $1
}
}
log_action_end_msg () {
+ log_action_end_msg_pre "$@"
if [ -z "${2:-}" ]; then
end="."
else
echo "failed${end}"
fi
fi
+ log_action_end_msg_post "$@"
}
+# Hooks for /etc/lsb-base-logging.sh
+log_daemon_msg_pre () { :; }
+log_daemon_msg_post () { :; }
+log_end_msg_pre () { :; }
+log_end_msg_post () { :; }
+log_action_end_msg_post () { :; }
+log_action_end_msg_post () { :; }
+
FANCYTTY=
[ -e /etc/lsb-base-logging.sh ] && . /etc/lsb-base-logging.sh || true